package com.ruoyi.web.controller.camera;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.YsyCamerasself;
import com.ruoyi.system.service.IYsyCamerasselfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 自有监控点信息Controller
 * 
 * @author ruoyi
 * @date 2021-03-09
 */
@RestController
@RequestMapping("/selfcamera/camerasself")
public class YsyCamerasselfController extends BaseController
{
    @Autowired
    private IYsyCamerasselfService ysyCamerasselfService;

    /**
     * 查询自有监控点信息列表
     */
//    @PreAuthorize("@ss.hasPermi('selfcamera:camerasself:list')")
    @GetMapping("/list")
    public TableDataInfo list(YsyCamerasself ysyCamerasself)
    {
        startPage();
        List<YsyCamerasself> list = ysyCamerasselfService.selectYsyCamerasselfList(ysyCamerasself);
        return getDataTable(list);
    }

    /**
     * 导出自有监控点信息列表
     */
//    @PreAuthorize("@ss.hasPermi('selfcamera:camerasself:export')")
    @Log(title = "自有监控点信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(YsyCamerasself YsyCamerasself)
    {
        List<YsyCamerasself> list = ysyCamerasselfService.selectYsyCamerasselfList(YsyCamerasself);
        ExcelUtil<YsyCamerasself> util = new ExcelUtil<YsyCamerasself>(YsyCamerasself.class);
        return util.exportExcel(list, "camerasself");
    }

    /**
     * 获取自有监控点信息详细信息
     */
//    @PreAuthorize("@ss.hasPermi('selfcamera:camerasself:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(ysyCamerasselfService.selectYsyCamerasselfById(id));
    }

    /**
     * 新增自有监控点信息
     */
//    @PreAuthorize("@ss.hasPermi('selfcamera:camerasself:add')")
    @Log(title = "自有监控点信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YsyCamerasself YsyCamerasself)
    {
        return toAjax(ysyCamerasselfService.insertYsyCamerasself(YsyCamerasself));
    }

    /**
     * 修改自有监控点信息
     */
//    @PreAuthorize("@ss.hasPermi('selfcamera:camerasself:edit')")
    @Log(title = "自有监控点信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YsyCamerasself YsyCamerasself)
    {
        return toAjax(ysyCamerasselfService.updateYsyCamerasself(YsyCamerasself));
    }

    /**
     * 删除自有监控点信息
     */
//    @PreAuthorize("@ss.hasPermi('selfcamera:camerasself:remove')")
    @Log(title = "自有监控点信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ysyCamerasselfService.deleteYsyCamerasselfByIds(ids));
    }
}
